package com.pozu.new_retail.service.impl;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.pozu.new_retail.dao.mapper.FavoriteRecordMapper;
import com.pozu.new_retail.dao.model.FavoriteRecord;
import com.pozu.new_retail.dao.vo.BriefGoodsVo;
import com.pozu.new_retail.dao.vo.BriefUgcVo;
import com.pozu.new_retail.service.FavoriteRecordService;

@Service("favoriteRecordService")
public class FavoriteRecordServiceImpl implements FavoriteRecordService {

	@Autowired
	private FavoriteRecordMapper favoriteRecordMapper;
	
	@Override
	public FavoriteRecord queryByMap(HashMap<String, Object> map) {
		return favoriteRecordMapper.queryByMap(map);
	}

	@Override
	public List<BriefGoodsVo> queryFavoriteGoodsByMap(HashMap<String, Object> map) {
		return favoriteRecordMapper.queryFavoriteGoodsByMap(map);
	}

	@Override
	public List<BriefUgcVo> queryFavoriteUgcsByMap(HashMap<String, Object> map) {
		return favoriteRecordMapper.queryFavoriteUgcsByMap(map);
	}

	@Override
	public int saveFavoriteRecord(FavoriteRecord favoriteRecord) {
		
		long time = System.currentTimeMillis();
		
		favoriteRecord.setCreatedTime(time);
		favoriteRecord.setUpdatedTime(time);
		
		return favoriteRecordMapper.insertFavoriteRecord(favoriteRecord);
	}

	@Override
	public int updateFavoriteRecord(FavoriteRecord favoriteRecord) {
		
		favoriteRecord.setUpdatedTime(System.currentTimeMillis());
		
		return favoriteRecordMapper.updateFavoriteRecord(favoriteRecord);
	}

	@Override
	public int queryCountByMap(HashMap<String, Object> map) {
		return favoriteRecordMapper.queryCountByMap(map);
	}

	@Override
	public int queryMyCountByMap(HashMap<String, Object> map) {
		return favoriteRecordMapper.queryMyCountByMap(map);
	}

}
